package indi.zhifa.recipe.bailan.framework.common.entity.exception;

import lombok.Getter;
import lombok.Setter;

/**
 * Description: 本系统所有主动抛出的业务异常类定义
 * @Copyright: Copyright (c) 2020-2028 北京华咨电力科技发展有限公司 All rights reserved.
 * @author: 褚智勇(hataksumo@163.com)
 * @date:  2021/12/2 14:02
 */
public class ServiceException extends RuntimeException {

    @Getter
    private final int code;

    public String getMsg(){
        return getMessage();
    }

    public ServiceException(String msg) {
        super(msg);
        //this.msg = msg;
        this.code = 500;
    }

    public ServiceException(String msg, Throwable e) {
        super(msg, e);
        this.code = 500;
    }

    public ServiceException(int pErrorCode, String msg) {
        super(msg);
        this.code = pErrorCode;
    }
    public ServiceException(int pErrorCode, String msg, Throwable e) {
        super(msg, e);
        this.code = pErrorCode;
    }
}
